#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


  int  row,
       col,
       width,
       height,
       x,
       y;

  long posi,
       lof,
       ofs;

  byte data,
       dfile[260],
       efile[260];

  FILE *tf,
       *ef,
       *cf;

int main( )
{
  tf = fopen( "c:/romhack/trans/free6/LFan2.smc","r+b");

  if ( !tf ) return -1;
  //

//  fseek( tf, ofs = 0x1A7CA, SEEK_SET );  // Part of Ststus
  fseek( tf, ofs = 0xAFDDE, SEEK_SET );  // Save / Load
  //
  sprintf( dfile, "c:/romhack/trans/free6/menu/%lX.mnu", ofs );
  cf = fopen( dfile,"wb");

  sprintf( efile, "c:/romhack/trans/free6/menu/%lX.txt", ofs );
  ef = fopen( efile,"wt");

  if ( !cf || !ef ){
    fcloseall( );
	  return -1;
  }

  row    = fgetc( tf );
  col    = fgetc( tf );
  height = fgetc( tf );
  width  = fgetc( tf );

  //
  fprintf( ef, ".MENU  c:/romhack/trans/free6/LFan2.smc %s %08lX  %3d %3d %3d %3d  %08lX  ",
               dfile,
               ofs,
               col,
							 row,
               width,
               height,
               ofs
          );

  fputc( width,cf );
  fputc( height, cf );
  posi    = 0;

  //
  while( posi < (width * height) )
  { //
    data = fgetc( tf );
    putw( 0x2200 | data, cf );
    posi++;

  }


  fprintf( ef, "%08lX  FFFFFFFF\n", ftell( tf ) );

  fcloseall( );
  return 0;
}

